package kr.co.spring329.sample.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.tmans.adminDao.AdminService;

@Service
public class ScheduleExecuteService
{
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	
	
	@Autowired
	private AdminService adminSerVice;
	/**
	 * 1분마다 로그파일 삭제
	 * @throws Exception
	 */
	public void deleteLogFile() throws Exception
	{
		this.logger.debug("deleteLogFile() 메소드 실행!!!!!");
		
//		this.logger.debug("deleteLogFile() 메소드 실행 완료 후 재실행이 되는지 테스트");
//		
//		Thread.sleep(70000);
	}
	
	/**
	 * 새벽 3시에 통계 업데이트
	 * @throws Exception
	 */
	public void updateStats() throws Exception
	{
		this.logger.debug("updateStats() 메소드 실행!!!!");
	}
	
	/**
	 * 5초마다 실행
	 * @throws Exception
	 */
	@Transactional(propagation=Propagation.REQUIRED, rollbackFor=Exception.class)
	public void simple01() throws Exception
	{
		this.logger.debug("simple01() 메소드 실행!!!");
		
		adminSerVice.scjul();
		
//		this.logger.debug("simple01() 메소드 실행 완료 후 재실행이 되는지 테스트");
//		
//		Thread.sleep(10000);
	}
}




























